/*     */ package btsm.servlet;
/*     */ 
/*     */ import btsm.bean.sysPro;
/*     */ import de.innosystec.unrar.Archive;
/*     */ import de.innosystec.unrar.exception.RarException;
/*     */ import de.innosystec.unrar.rarfile.FileHeader;
/*     */ import de.innosystec.unrar.rarfile.MainHeader;
/*     */ import java.io.File;
/*     */ import java.io.FileNotFoundException;
/*     */ import java.io.FileOutputStream;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ import javax.servlet.ServletException;
/*     */ import javax.servlet.http.HttpServlet;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class ser_upload extends HttpServlet
/*     */ {
/*  26 */   private String strUPPath = "";
/*     */ 
/*     */   public void init() throws ServletException {
/*  29 */     sysPro sPro = new sysPro();
/*  30 */     this.strUPPath = (sPro.getUploadpath() + "readexcel/");
/*     */   }
/*     */ 
/*     */   private void unPackFile(String uppath, String strPack) {
/*  34 */     File f = new File(uppath + strPack);
/*     */ 
/*  36 */     Archive aRar = null;
/*  38 */       aRar = new Archive(f);
/*  46 */     if (aRar != null) {
/*  47 */       aRar.getMainHeader().print();
/*  48 */       FileHeader fh = aRar.nextFileHeader();
/*  49 */       while (fh != null) {
/*     */         try {
/*  51 */           File outRar = new File(uppath + fh.getFileNameString().trim());
/*  52 */           System.out.println(outRar.getAbsolutePath());
/*  53 */           FileOutputStream os = new FileOutputStream(outRar);
/*  54 */           aRar.extractFile(fh, os);
/*  55 */           os.close();
/*     */         }
/*     */         catch (FileNotFoundException e) {
/*  58 */           e.printStackTrace();
/*     */         }
/*     */         catch (RarException e) {
/*  61 */           e.printStackTrace();
/*     */         }
/*     */         catch (IOException e) {
/*  64 */           e.printStackTrace();
/*     */         }
/*  66 */         fh = aRar.nextFileHeader();
/*     */       }
/*     */       try {
/*  69 */         aRar.close();
/*     */       }
/*     */       catch (IOException e) {
/*  72 */         e.printStackTrace();
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public static boolean moveFile(String srcFile, String destPath, String destFName)
/*     */   {
/*  80 */     File file = new File(srcFile);
/*     */ 
/*  82 */     File dir = new File(destPath);
/*     */ 
/*  84 */     File destPN = new File(dir, destFName);
/*     */ 
/*  87 */     if (destPN.exists()) {
/*  88 */       destPN.delete();
/*     */     }
/*  90 */     if ((destFName == null) || (destFName.equalsIgnoreCase(""))) {
/*  91 */       destFName = file.getName();
/*     */     }
/*     */ 
/*  94 */     boolean success = file.renameTo(destPN);
/*     */ 
/*  96 */     return success;
/*     */   }
/*     */ 
/*     */   public void doPost(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/* 120 */     throw new Error("Unresolved compilation problems: \n\tSyntax error, parameterized types are only available if source level is 1.5\n\tSyntax error, 'for each' statements are only available if source level is 1.5\n\tCan only iterate over an array or an instance of java.lang.Iterable\n");
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsm.servlet.ser_upload
 * JD-Core Version:    0.6.2
 */